unit UCSSelect;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UBaseModalForm, StdCtrls, ExtCtrls,
  BourbakiLogic, ConceptualSchemes;
type
  TCSSelect = class(TBaseModalForm)
    lbCSchemes: TListBox;
    Panel3: TPanel;
    Label1: TLabel;
    procedure lbCSchemesDblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function SelectCS(Doc: TBourbakiDoc): TConceptualScheme;
implementation

function SelectCS(Doc: TBourbakiDoc): TConceptualScheme;
var
  i: Integer;
begin
  with TCSSelect.Create(nil) do
  try
    for i := 0 to Pred(Doc.SchemeCount) do
      lbCSchemes.AddItem(Doc.Scheme[i].Caption, Doc.Scheme[i]);
    if (ShowModal = mrOk) and (lbCSchemes.ItemIndex >= 0) then
      Result := TConceptualScheme(lbCSchemes.Items.Objects[lbCSchemes.ItemIndex])
    else
      Result := nil;
  finally
    Free;
  end;

end;

{$R *.dfm}

procedure TCSSelect.lbCSchemesDblClick(Sender: TObject);
begin
  inherited;
  bOK.Click;
end;

end.

